// 类
// 继承
// 属性

// 父类
class Father {
  // 私有属性: 只可以在父类访问
  private _litteMoney: number;
	
  // 存储器
  get litterMoney() {
    return this._litteMoney;
  }
  set litterMoney(newValue: number) {
    this._litteMoney = newValue;
  }

  // 保护属性 : 只能在类“Father”及其子类中访问
  protected money: number;
  constructor(money: number) {
    this.money = money;
    this._litteMoney = 110;
  }
}

// 子类
class Person extends Father {
  // 公共属性： 任何地方
  public readonly name: string;
  public age: number;
  constructor(name: string, age: number) {
    super(10000);
    this.name = name;
    this.age = age;
    this.money += 10000;
    this.money -= 1000;
  }
  public sayName() {
    console.log(`我是${this.name}--今年${this.age}岁了`);
  }
}

const p = new Person("张三", 18);
console.log(p.litterMoney);
p.litterMoney = 12345;
console.log(p.litterMoney);
console.log(p);
